<?php
class AccountAction extends Action {
	function _initialize()
	{
		$this->checkUser();
	}
	
	function checkUser()
	{
		$user=getMember();
		if(!$user)
		{
			//尝试COOKIE登录
			$username=cookie("username");
			$password=cookie("password");
			
			if($user=checkMember($username,$password))
			{
				setMember($user);
			}
			else
			{
				session("LASTURL","http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
				$this->redirect("/Passport/login");
			}
		}
		else
		{
			$this->assign('user',$user);
		}
	}
}